********************************************************************************
********************************************************************************
******************          Replication files for				 ***************
****************** "Why Me?" The Role of Perceived Victimhood    ***************
****************** 			in American Politics				 ***************
******************   			Miles T. Armaly					 ***************
****************** 				Adam M. Enders					 ***************
****************** 												 ***************
****************** 				11 August 2020			         ***************	
******************												 ***************
******************			   Stata version 14.2				 ***************
********************************************************************************
********************************************************************************



import delimited "25 March 2019.csv", encoding(ISO-8859-1)clear

* Remove researcher generated responses
drop if distribution == "preview"
drop if distribution == "test"

drop startdate-progress finished-userlanguage

* Under 5 mins to complete survey
gen short = .
replace short = 0 if duration > 300
replace short = 1 if duration < 300

* Party Identification
gen pid1 = q15
gen pid2rep = q17
gen pid2dem = q19
gen pid2ind = q21

gen pid = -3 if pid2dem == 1
replace pid = -2 if pid2dem == 2
replace pid = -1 if pid2ind == 2
replace pid = 0 if pid2ind == 3
replace pid = 0 if pid2ind == 4
replace pid = 1 if pid2ind == 1
replace pid = 2 if pid2rep == 2
replace pid = 3 if pid2rep == 1

gen rep = .
replace rep = 0 if pid < 0
replace rep = 1 if pid > 0 & pid < .

label define rep 0 "Democrat" 1 "Republican" 
label values rep rep

gen pid3 = pid
recode pid3 (-3=1) (-2=1) (-1=1) (0=2) (1=3) (2=3) (3=3)

label define pid3 1 "Democrat" 2 "Independent" 3 "Republican" 
label values pid3 pid3


* Ideology
gen ideo = q11 - 4

gen conserv = .
replace conserv = 1 if ideo > 0 & ideo < .
replace conserv = 0 if ideo < 0


* Strength of partisan and ideological attachments
gen pidstrength = abs(pid)
gen ideostrength = abs(ideo)


* Treatment indicators
gen tTreat = .
replace tTreat = 0 if q63_pagesubmit == .
replace tTreat = 1 if q63_pagesubmit != .

gen bTreat = .
replace bTreat = 0 if q62_pagesubmit == .
replace bTreat = 1 if q62_pagesubmit != . 

gen treatment = .
replace treatment = 0 if bTreat == 0 & tTreat == 0
replace treatment = 1 if tTreat == 1
replace treatment = 2 if bTreat == 1

label define treatment 0 "Control" 1 "A" 2 "B" 
label values treatment treatment

* Vote choice
gen primtrump = .
replace primtrump = 0 if q50 != . & q50 != 4
replace primtrump = 1 if q50 == 4

gen gentrump = .
replace gentrump = 0 if v71 != . & v71 != 1
replace gentrump = 1 if v71 == 1

gen vote2016 = .
replace vote2016 = 1 if v71 == 2 
replace vote2016 = 2 if v71 == 1
replace vote2016 = 3 if v71 > 2 & v71 < .


* Feeling thermometers
gen trumpTherm = q58_3 


* Racial resentment
alpha q42_1-q42_4, gen(raceresent)


* Conspiratorial thinking
foreach v of var q23_1-q23_5{ 
	recode `v' (4=3) (5=4) (7=5)
	gen `v'2 = 6-`v'
}

alpha q23_12-q23_52, gen(conspiracism) 


* Perceived corruption
recode q25 (28=4) (29=5)
gen corrupt = 6-q25


* Trust in government
gen trust = q27


* Aid to minorities
gen blacksHelp = q44


* Build the wall
gen wall = q47
recode wall (1=1) (2=-1) (3 = 0)


* Political correctness (high value = people are sensitive)
gen pcorrect = q52 

* Personality
alpha q31_2 q31_7, gen(agreeableness)
alpha q31_4 q31_9, gen(stability)


* Anti-elite
alpha q50_6 q50_7, gen(antielite)


* Efficacy
gen efficacy = q50_1 * -1


* Interest
gen interest = 5-q68


* Education
gen edu = education 
recode edu (-3105 = .)


* Income
gen income = hhi
replace income = . if hhi < 1


* Gender
gen female = gender - 1


* Residence in the south
gen south = 0
replace south = 1 if region == 3


* Religiosity
gen attendance = q36
recode attendance (5=0) (4=1) (3=2) (2=3) (1=4)
 

* Race
gen white = 0
replace white = 1 if ethnicity == 1

gen black = 0 
replace black = 1 if ethnicity == 2

gen hispanic2 = 0
replace hispanic2 = 1 if hispanic != 1


* Rescale all variables to range 0-1
foreach v of var raceresent age edu attendance ///
	interest conspiracism trust corrupt ///
	blacksHelp wall pcorrect pid ideo ///
	agreeableness stability pidstrength ///
	ideostrength trumpTherm income{ 
	su `v', meanonly 
	gen `v'2 = (`v' - r(min))/(r(max) - r(min)) 
}

********************************************************************************

*****
** Measuring victim identity
*****

* EFA
ssc install paran
set seed 12345

paran q3_1-q3_3 q3_5 q2_1-q2_3 q2_5, factor(pcf)

factor q3_1-q3_3 q3_5 q2_1-q2_3 q2_5, pcf
factor q3_1-q3_3 q3_5 q2_1-q2_3 q2_5, pcf factor(2)
rotate, promax
estat common

* Unidimensional model
sem (SYS -> q3_1-q3_3 q3_5 q2_1-q2_3 q2_5), ///
	 cov(e.q3_1*e.q3_5) standardize
est store mod1
estat gof, stats(all)	 

* Two-factor model
sem (SYS -> q3_1-q3_3 q3_5) (EGO -> q2_1-q2_3 q2_5), ///
	 cov(e.q3_1*e.q3_5) standardize
est store mod2
lrtest mod1 mod2
estat gof, stats(all)

* Generate scales
alpha q3_1-q3_3 q3_5, gen(systemic)

alpha q2_1-q2_3 q2_5, gen(egocentric)

foreach v of var egocentric systemic{ 
	su `v', meanonly 
	gen `v'2 = (`v' - r(min))/(r(max) - r(min)) 
}

*****
** Correlates of victim identity
*****

pwcorr systemic2 egocentric2 conspiracism2 corrupt trust ///
	 antielite efficacy stability agreeableness if short == 0, sig obs
	 
pwcorr systemic2 egocentric2 edu age female income ///
	black hispanic if short == 0, sig obs
	
*****
** Victim identity and other 
** political orientations
*****	

reg pcorrect2 systemic2 egocentric2 pid2 ideo2 edu2 interest2 ///
	attendance2 age2 female black hispanic south i.treatment if short == 0
margins, at(systemic2=(0(.1)1))
margins, at(egocentric2=(0(.1)1))	

reg wall2 systemic2 egocentric2 pid2 ideo2 edu2 interest2 ///
	attendance2 age2 female black hispanic south i.treatment if short == 0 
margins, at(systemic2=(0(.1)1))
margins, at(egocentric2=(0(.1)1))

reg blacksHelp2 systemic2 egocentric2 pid2 ideo2 edu2 interest2 ///
	attendance2 age2 female black hispanic south i.treatment if short == 0 
margins, at(systemic2=(0(.1)1))
margins, at(egocentric2=(0(.1)1))		

reg raceresent2 systemic2 egocentric2 pid2 ideo2 edu2 interest2 ///
	attendance2 age2 female black hispanic south  i.treatment if short == 0
margins, at(systemic2=(0(.1)1))
margins, at(egocentric2=(0(.1)1))	

test _b[systemic2] = 0
local sign_syste = sign(_b[systemic2])
di "Ho: coef <= 0  p-value = " 1-ttail(r(df_r),`sign_syste'*sqrt(r(F)))

*****
** Victim identity and Donald
** Trump vote choice and affect
*****	

pwcorr systemic2 egocentric2 pid2 ideo2, sig

* 2016 vote choice
logit gentrump c.systemic2 egocentric2 pid2 ideo2  ///
	edu2 attendance2 interest2 age2 female black hispanic ///
	south i.treatment if short == 0	
margins, at(systemic2=(0(.1)1))
margins, at(egocentric2=(0(.1)1))	 

* Trump feeling thermometer	
reg trumpTherm2 systemic2 egocentric2 pid2 ideo2 ///
	edu2 attendance2 interest2 age2 female black hispanic ///
	south i.treatment if short == 0	
margins, at(systemic2=(0(.1)1))
margins, at(egocentric2=(0(.1)1))



***********************************
******* Read in data from August 2020 
***********************************

clear
import delimited "5 August 2020.csv", encoding(ISO-8859-1)

*****
** Recode and construct variables
*****

* Remove researcher generated responses
drop if distribution == "preview"
drop if distribution == "test"

drop startdate-progress finished-userlanguage


* Party Identification
gen pid = -3 if q21 == 1
replace pid = -2 if q21 == 2
replace pid = -1 if q22 == 2
replace pid = 0 if q22 == 3
replace pid = 0 if q22 == 4
replace pid = 1 if q22 == 1
replace pid = 2 if q20 == 2
replace pid = 3 if q20 == 1

gen rep = .
replace rep = 0 if pid < 0
replace rep = 1 if pid > 0 & pid < .


* Ideology
gen ideo = q23 - 4
replace ideo = . if q23 > 7

gen conserv = .
replace conserv = 1 if ideo > 0 & ideo < .
replace conserv = 0 if ideo < 0


* Strength of partisan and ideological attachments
gen pidstrength = abs(pid)
gen ideostrength = abs(ideo)


* Collective narcissism
alpha q4_1-q4_8, gen(cnarcissism)


* Trait narcissism
alpha q5_1-q5_6, gen(tnarcissism)


* State narcissism
alpha q27_1-q27_7, gen(snarcissism)


* Relative depravation
gen reldep1 = q6
gen reldep2 = q7


* System justification
alpha q8_1-q8_8, gen(systemjust)


* Treated or not
gen treated = .
replace treated = 0 if random == 1
replace treated = 1 if random == 2


* Under 5 mins to complete survey
gen short = .
replace short = 0 if duration > 300
replace short = 1 if duration < 300


* Who are the victimizers?
gen v_system = (q26_1 * -1) + 5
gen v_fedgov = (q26_2 * -1) + 5
gen v_dems = (q26_3 * -1) + 5
gen v_reps = (q26_4 * -1) + 5
gen v_economy = (q26_5 * -1) + 5
gen v_otherside = (q26_6 * -1) + 5
gen v_socialists = (q26_7 * -1) + 5
gen v_judicial = (q26_9 * -1) + 5

alpha v_system-v_judicial, gen(victimizers)


* Education
gen edu = education 
recode edu (-3105 = .)


* Income
gen income = hhi
replace income = . if hhi < 1


* Gender
gen female = gender - 1


* Residence in the south
gen south = 0
replace south = 1 if region == 3
 

* Race
gen white = 0
replace white = 1 if ethnicity == 1

gen black = 0 
replace black = 1 if ethnicity == 2

gen hispanic2 = 0
replace hispanic2 = 1 if hispanic != 1


* Rescale all variables to range 0-1
foreach v of var income edu snarcissism tnarcissism cnarcissism ///
	reldep1 reldep2 systemjust pid ideo pidstrength ideostrength ///
	victimizers age { 
	su `v', meanonly 
	gen `v'2 = (`v' - r(min))/(r(max) - r(min)) 
}


* Unidimensional model
sem (SYS -> q2_1-q2_3 q2_5 q3_1-q3_4 if short == 0), standardize
est store mod1
estat gof, stats(all)	 

* Two-factor model
sem (SYS -> q3_1-q3_4) (EGO -> q2_1-q2_3 q2_5 if short == 0), ///
	cov(e.q3_1*e.q3_4) standardize
est store mod2
lrtest mod1 mod2
estat gof, stats(all)

* Generate scales
alpha q3_1-q3_4, gen(systemic)
alpha q2_1-q2_3 q2_5, gen(egocentric)

foreach v of var egocentric systemic{ 
	su `v', meanonly 
	gen `v'2 = (`v' - r(min))/(r(max) - r(min)) 
}

*****
** Correlation between victim identity
** and related psychological traits
*****

pwcorr systemic egocentric snarcissism tnarcissism cnarcissism ///
	reldep1 reldep2 systemjust if short == 0, obs sig
	
*****
** Who are the victimizers?
*****	

pwcorr victimizers egocentric systemic if short == 0

corr egocentric systemic v_system-v_judic if short == 0

foreach var of varlist v_system-v_judicial{
	reg `var' egocentric2 systemic2 pid2 ideo2 edu2 ///
	age2 female black hispanic2 south i.treated if short == 0
}

*****
** Discriminant validity
*****	
	
* Collective narcissism	
sem (NAR -> q4_1-q4_8) (SYS -> q3_1-q3_4) ///
	(EGO -> q2_1-q2_3 q2_5), standardize
di (.7127554^2 + .7283891^2 + .8008385^2  + .7669862^2 + .7006364^2 ///
	+ .273397^2 + .7352931^2 + .691685^2)/8
di (.7091036^2 + .838922^2 + .7877018^2  + .5480193^2)/4
di (.8144538^2 + .7685686^2 + .7182623^2  + .7703786^2)/4
di .4991823^2
di .4909283^2

* Trait narcissism	
sem (NAR -> q5_1-q5_6) (SYS -> q3_1-q3_4) ///
	(EGO -> q2_1-q2_3 q2_5), standardize
di (.419943^2 + .4079218^2 + .5995891^2 + .7398197^2 + ///
	.7451534^2 + .7874875^2)/6
di (.6905471^2 + .8450256^2 + .803347^2  + .5267895^2)/4
di (.8165019^2 + .7706326^2 + .7164885^2  + .7674909^2)/4
di .5523202^2 
di .4978654^2 

* State narcissism	
sem (NAR -> q27_1-q27_7) (SYS -> q3_1-q3_4) ///
	(EGO -> q2_1-q2_3 q2_5), standardize
di (.6769705^2 + .6003175^2 + .7210973^2 + .7861176^2 + ///
	.599811^2 + .5680641^2 + .6161961^2)/7
di (.6959366^2 + .8402659^2 + .7958456^2  + .5338958^2)/4
di (.8167287^2 + .7625447^2 + .7265311^2  + .7711901^2)/4
di .4564221^2 
di .434853^2 

* System justification
sem (SYS -> q8_1-q8_8) (SYS -> q3_1-q3_4) ///
	(EGO -> q2_1-q2_3 q2_5), standardize
di (.814479^2 + .822285^2 + -.3254748^2 + .6690248^2 + ///
	.7925102^2 + .7894891^2 + -.2009838^2 + .7119411^2)/8
di (.7119425^2 + .8401649^2 + .7803022^2  + .5561738^2)/4
di (.8133322^2 + .7688147^2 + .7188649^2  + .7708106^2)/4
di -0.0589352^2 
di .0160289^2 
	
	
**********
*** Experiment
***********	

clear
import delimited "24 April 2020.csv", encoding(ISO-8859-1)

*****
** Recode and construct variables
*****

* Remove researcher generated responses
drop if distribution == "preview"
drop if distribution == "test"

drop startdate-progress finished-userlanguage

drop if robot != 2

* Party Identification
gen pid = -3 if pid2dem == 1
replace pid = -2 if pid2dem == 2
replace pid = -1 if pid2ind == 2
replace pid = 0 if pid2ind == 3
replace pid = 0 if pid2ind == 4
replace pid = 1 if pid2ind == 1
replace pid = 2 if pid2rep == 2
replace pid = 3 if pid2rep == 1

gen rep = .
replace rep = 0 if pid < 0
replace rep = 1 if pid > 0 & pid < .

gen indep = . 
replace indep = 0 if pid != .
replace indep = 1 if pid == 0

gen pid3 = pid
recode pid3 (-3=1) (-2=1) (-1=1) (0=2) (1=3) (2=3) (3=3)


* Ideology
gen ideo = ideology - 4
replace ideo = . if ideo > 3

gen conserv = .
replace conserv = 1 if ideo > 0 & ideo < .
replace conserv = 0 if ideo < 0

gen moderate = . 
replace moderate = 0 if ideo != .
replace moderate = 1 if ideo == 0


* Strength of partisan and ideological attachments
gen pidstrength = abs(pid)
gen ideostrength = abs(ideo)


* Treatment indicators
gen selftreat = .
replace selftreat = 1 if random == 3
replace selftreat = 0 if random == 4

gen implicit = .
replace implicit = 1 if random == 1
replace implicit = 0 if random == 4

gen explicit = .
replace explicit = 1 if random == 2
replace explicit = 0 if random == 4


* Sociotropic
alpha socio_1 socio_2 socio_3 socio_5, gen(systemic)


* Egocentric
alpha ego_1-ego_4, gen(egocentric)


* Entitlement
alpha ent_1-ent_4, gen(entitlement)


* Narcissism
alpha ent_5-ent_8, gen(narcissism)
 

* Manipulation check
gen pass = .
replace pass = 0 if manip == 3
replace pass = 0 if manip == 4
replace pass = 0 if rep == 0 & manip == 2
replace pass = 0 if rep == 1 & manip == 1
replace pass = 1 if rep == 0 & manip == 1
replace pass = 1 if rep == 1 & manip == 2
replace pass = 1 if random == 3
replace pass = 1 if random == 4


* Under 2 mins to complete survey
gen short = .
replace short = 0 if duration > 120
replace short = 1 if duration < 120


* Gender
gen female = gender - 1


* Income
replace income = income - 10


* Race
gen white = 0
replace white = 1 if race == 1

gen black = 0 
replace black = 1 if race == 2

gen hispanic = 0
replace hispanic = 1 if race == 3


* Rescale all variables to range 0-1
foreach v of var egocentric systemic narcissism ///
	entitlement pid ideo edu age income { 
	su `v', meanonly 
	gen `v'2 = (`v' - r(min))/(r(max) - r(min)) 
}

********************************************************************************

*****
** Correlations
*****	

pwcorr systemic egocentric entitlement narcissism, sig

pwcorr systemic egocentric pid ideo, sig

*****
** Experimental results, no controls
*****	

*bysort selftreat: sum age income female white pid ideo 
*bysort explicit: sum age income female white pid ideo 

set seed 12345
bootstrap: reg systemic2 selftreat
margins, over(selftreat)

set seed 12345
bootstrap: reg egocentric2 selftreat
margins, over(selftreat)

set seed 12345
bootstrap: reg systemic2 explicit if pass == 1
margins, over(explicit)	

set seed 12345
bootstrap: reg egocentric2 explicit if pass == 1
margins, over(explicit)

*****
** Experimental results, controls
*****	

set seed 12345
bootstrap: reg systemic2 selftreat pid2 edu2 age2 income2 female white 


set seed 12345
bootstrap: reg egocentric2 selftreat pid2 edu2 age2 income2 female white 


set seed 12345
bootstrap: reg systemic2 explicit indep edu2 age2 income2 female ///
	white if pass == 1


set seed 12345
bootstrap: reg egocentric2 explicit indep edu2 age2 income2 female ///
	white if pass == 1



*****
** Experimental results, 
** narcissim and entitlement
** in appendix
*****	

* Self-induced
set seed 12345
bootstrap: reg entitlement2 selftreat pid2 edu2 age2 income2 female white 

set seed 12345
bootstrap: reg narcissism2 selftreat pid2 edu2 age2 income2 female white 


* Explicit
set seed 12345
bootstrap: reg entitlement2 explicit indep edu2 age2 income2 female ///
	white if pass == 1

set seed 12345
bootstrap: reg narcissism2 explicit indep edu2 age2 income2 female ///
	white if pass == 1
